﻿using Application.AppService.IConfig;
using AutoMapper;
using Domain;
using Domain.Entity.Config;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers.MoKuaiYi_第一个模块_.Interview_management_面试管理_
{
    public class ERResultsController : Controller
    {
        private readonly IMapper mapper;
        private readonly IEngage_resumeAppService eRAppService;
        private readonly IEngage_interviewAppService eIAppService;

        public ERResultsController(IMapper mapper, IEngage_resumeAppService eRAppService, IEngage_interviewAppService eIAppService)
        {
            this.mapper = mapper;
            this.eRAppService = eRAppService;
            this.eIAppService = eIAppService;
        }
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult Index1()
        {
            return View();
        }
        [HttpPost("FYERResults")]
        public IActionResult FYERResults(int page, int pageSize)
        {

            ERFenYE erFenYE = eRAppService.DateERSAsync(page, pageSize, 1);
            return Json(erFenYE);
        }
        [HttpPost("AddEI")]
        public async Task<IActionResult> AddEI(Engage_interview ei)
        {
            bool rs = await eIAppService.AddEIAsync(ei);
            return Json(rs);
        }
        [HttpPost("GetEIByName")]
        public async Task<IActionResult> GetEIByName(int id)
        {
            Engage_interview ei = await eIAppService.GetEIByNameAsync(id);
            return Json(ei);
        }
        [HttpPost("UpdateERS")]
        public async Task<IActionResult> UpdateERS(Engage_resume er)
        {
            er.Interview_status = 2;
            bool rs = await eRAppService.UpdateERSAsync(er);
            return Json(rs);
        }
        [HttpPost("GetERByName")]
        public async Task<IActionResult> GetERByName(int id)
        {
            Engage_resume er = await eRAppService.GetERByNameAsync(id);
            return Json(er);
        }
    }
}
